<?php /* Smarty version 2.6.20, created on 2013-05-25 01:44:44
         compiled from _core/pagelogin/pageuserlogin.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'escape', '_core/pagelogin/pageuserlogin.tpl', 18, false),)), $this); ?>
function PageUserLogin(options,returnurl) {
  this._account = document.getElementById('input1');
  this._password = document.getElementById('input2');
  this._loginBtn = document.getElementById('button1');
  this._options = options;
  this.rl= returnurl;

  this._createElements();
}

PageUserLogin.prototype._createElements = function() {
  var _self = this;

  
  var func = function() { new RequestUtils()._pcustom('login', 'a=' + encodeURIComponent(_self._account.value) + '&p=' + encodeURIComponent(_self._password.value), function(result, params) { if (result.type) {
                                                                                                                                                                                                 if(_self.rl=='')
                                                                                                                                                                                                  {
                                                                                                                                                                                                if (result.type == '<?php echo ((is_array($_tmp=@USER_TYPE_MANAGER_ASSISTANT)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
') {
                                                                                                                                                                                                	
                                                                                                                             
                                                                                                                                                                                                  if (_self._options.template != 'pagecustomer') {
                                                                                                                                                                                                    location.href = '?p=pageasst&t=pageb1asstworks&m=' + JSON.stringify({ a: 1, b: 1, c: 1, d:1 });
                                                                                                                                                                                                  } else {
                                                                                                                                                                                                    location.href = '?p=pageasst' + '&t=' + _self._options.template + '&m=' + JSON.stringify({ a: 2, b: 2 }) + '&opts=' + _self._options.option;
                                                                                                                                                                                                  }
                                                                                                                                                                                                  
                                                                                                                                                                                                } else if (result.type == '<?php echo ((is_array($_tmp=@USER_TYPE_CUSTOMER_SERVICE)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
') {
                                                                                                                                                                                                  if (_self._options.template != 'pagecustomer') {
                                                                                                                                                                                                    location.href = '?p=pageserv&t=pageb1servworks&m=' + JSON.stringify({ a: 1, b: 1, c: 1, d: 1});
                                                                                                                                                                                                  } else {
                                                                                                                                                                                                    location.href = '?p=pageserv' + '&t=' + _self._options.template + '&m=' + JSON.stringify({ a: 2, b: 2 }) + '&opts=' + _self._options.option;
                                                                                                                                                                                                  }
                                                                                                                                                                                                } else if (result.type == '<?php echo ((is_array($_tmp=@USER_TYPE_MANAGER)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
') {
                                                                                                                                                                                                  location.href = '?p=pagemanager&t=pageb1managercustomworks&m=' + JSON.stringify({ a: 1, b: 1, c: 1, d:1 });
                                                                                                                                                                                                } else if (result.type == '<?php echo ((is_array($_tmp=@USER_TYPE_ADMIN)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
') {
                                                                                                                                                                                                  location.href = '?p=pageadmin&t=pageb1deletecus&m=' + JSON.stringify({ a: 1, b: 1, c: 1 });
                                                                                                                                                                                                } else if (result.type == '<?php echo ((is_array($_tmp=@USER_TYPE_ACCOUNTANT)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
') {
                                                                                                                                                                                                  location.href = '?p=pageacct&t=pageb1acctcustomworks&m=' + JSON.stringify({ a: 1, b: 1, c: 1, d:1 });
                                                                                                                                                                                                } else {
                                                                                                                                                                                                  window.alert('User Restricted');
                                                                                                                                                                                                }
                                                                                                                                                                                                }else{
                                                                                                                                                                                                  location.href = _self.rl;
                                                                                                                                                                                                }
                                                                                                                                                                                                
                                                                                                                                                                                              } else {
                                                                                                                                                                                                window.alert('Incorrect Account and/or Password');
                                                                                                                                                                                              }
                                                                                                                                                                                            }, { pos: DOMUtils.findPos(_self._loginBtn) });
                         }
  this._account.onkeypress = function(e) { var code = DOMUtils.getEventCode(e);
                                           if (code == 13) {
                                             func();
                                           }
                                         };
  this._password.onkeypress = function(e) { var code = DOMUtils.getEventCode(e);
                                            if (code == 13) {
                                              func();
                                            }
                                          };
  
  this._loginBtn.onclick = function() { func();
                                      };
};